<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

//公共页
Route::get('/', function () {
    return view('welcome');
});

//前台用户
Route::group(['prefix' => '', 'namespace' => 'Auth', 'middleware' => ['delnull']], function ($router) {
    // Authentication Routes...
    $router->get('login', 'LoginController@showLoginForm')->name('login');
    $router->post('login', 'LoginController@login');
    $router->post('logout', 'LoginController@logout')->name('logout');
    // Registration Routes...
    $router->get('register', 'RegisterController@showRegistrationForm')->name('register');
    $router->post('register', 'RegisterController@register');
    // Password Reset Routes...
    $router->get('password/reset', 'ForgotPasswordController@showLinkRequestForm')->name('password.request');
    $router->post('password/email', 'ForgotPasswordController@sendResetLinkEmail')->name('password.email');
    $router->get('password/reset/{token}', 'ResetPasswordController@showResetForm')->name('password.reset');
    $router->post('password/reset', 'ResetPasswordController@reset')->name('password.update');
    // Email Verification Routes...
    $router->get('email/verify', 'VerificationController@show')->name('verification.notice');
    $router->get('email/verify/{id}', 'VerificationController@verify')->name('verification.verify');
    $router->get('email/resend', 'VerificationController@resend')->name('verification.resend');
    //主逻辑
    $router->get('/home', 'HomeController@index')->name('home');
    $router->match(['POST', 'GET'], '/test', 'HomeController@Test');
    $router->match(['POST', 'GET'], '/test2', 'HomeController@Test2');
    $router->match(['POST', 'GET'], '/test3', 'HomeController@Test3');
});

//后台用户
Route::group(['prefix' => 'admin', 'namespace' => 'Admin', 'middleware' => ['delnull']], function ($router) {
    // Authentication Routes...
    $router->get('login', 'LoginController@showLoginForm')->name('admin.login');
    $router->post('login', 'LoginController@login');
    $router->post('logout', 'LoginController@logout')->name('admin.logout');
    // Registration Routes...
    $router->get('register', 'RegisterController@showRegistrationForm')->name('admin.register');
    $router->post('register', 'RegisterController@register');
    // Password Reset Routes...
    $router->get('password/reset', 'ForgotPasswordController@showLinkRequestForm')->name('admin.password.request');
    $router->post('password/email', 'ForgotPasswordController@sendResetLinkEmail')->name('admin.password.email');
    $router->get('password/reset/{token}', 'ResetPasswordController@showResetForm')->name('admin.password.reset');
    $router->post('password/reset', 'ResetPasswordController@reset')->name('admin.password.update');
    // Email Verification Routes...
    $router->get('email/verify', 'VerificationController@show')->name('admin.verification.notice');
    $router->get('email/verify/{id}', 'VerificationController@verify')->name('admin.verification.verify');
    $router->get('email/resend', 'VerificationController@resend')->name('admin.verification.resend');
    //主逻辑
    $router->get('/home', 'HomeController@index')->name('admin.home');
});
